package com.axsoft.jobimp.tests;

import junit.framework.TestCase;

import com.axsoft.jobimp.BEX;
import com.axsoft.jobimp.Constants;
import com.axsoft.jobimp.OHeader;
import com.axsoft.jobimp.types.BLK;
import com.axsoft.jobimp.types.UTF8;
import com.axsoft.jobimp.types.wTLD;

public class BEXTest extends TestCase {

	public void testParseBLK() {
		final byte[] bytes = {0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
							  0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
							  0x0E, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
							  0x06, 0x6A, 0x6F, 0x62, 0x69, 0x6D, 0x70};
		BEX bex = new BEX(new BLK(bytes));
		final UTF8 accountName = new UTF8("jobimp");
		final wTLD wTld = new wTLD(Constants.WTLD_UTF8_ACCOUNT_NAME, accountName.getData());
		final OHeader header = new OHeader(0x00, Constants.OBIMP_BEX_COM, Constants.OBIMP_BEX_COM_CLI_HELLO, 0x0000, wTld.getLength());
		
		assertTrue(OTestUtils.headersEquals(header, bex.getHeader()));
		assertTrue(OTestUtils.wTLDEquals(wTld, bex.getWTld()));
	}
}
